const envObj = require('./config/index.js');
//http请求
const {
  ajax,
  api
} = require('app/index.js')
App({
  ajax: ajax,
  api: api,
  $protocol: envObj.baseUrl.protocol,
  defaultImg: '',
  globalData: {
    timer: null
  },
  onLaunch() {
  },
  showMsg: function(msg){
    wx.showToast({
      icon:"none",
      title:msg
    })
  },
  iPhoneCall: function (){
    wx.makePhoneCall({
      phoneNumber: '400-1168897' //仅为示例
    });
  },
  setTimer : function (success, delayTime){
    if(this.globalData.timer !== null){
      clearTimeout(this.globalData.timer)
    }
    this.globalData.timer = setTimeout(()=>{
      success()
      clearTimeout(this.globalData.timer)
      this.globalData.timer = null
    }, delayTime)
  },
})
